from rest_framework import serializers

from basic_info.models import CustomerModel


class CustomerSerializer(serializers.ModelSerializer):
    """
    客户信息的序列化器
    """

    class Meta:
        model = CustomerModel
        fields = '__all__'


class CustomerFindSerializer(serializers.ModelSerializer):
    """
    搜索过滤的序列化器
    """
    name = serializers.CharField(required=False, write_only=True, help_text='客户名称关键字')

    class Meta:
        model = CustomerModel
        fields = ['name', 'mobile', 'phone']
